package com.agritech.command;

import com.agritech.machine.AgriculturalMachine;

/**
 * 启动农机命令
 * 命令模式的具体命令实现，封装了启动农机的操作
 */
public class StartMachineCommand implements Command {
    private AgriculturalMachine machine;
    
    public StartMachineCommand(AgriculturalMachine machine) {
        this.machine = machine;
    }
    
    @Override
    public void execute() {
        System.out.println("执行命令: 启动农机 " + machine.getId());
        machine.start();
    }
    
    @Override
    public void undo() {
        System.out.println("撤销命令: 停止农机 " + machine.getId());
        machine.stop(); // 撤销启动操作即为停止
    }

    @Override
    public String getDescription() {
        return "启动农机 " + machine.getType() + " (ID: " + machine.getId() + ")";
    }
}